package com.looncin.oj.judge.codesandbox;

import com.looncin.oj.judge.codesandbox.impl.ExampleCodeSandBoxImpl;
import com.looncin.oj.judge.codesandbox.impl.RemoteCodeSandBoxImpl;

import javax.annotation.Resource;

/**
 * 代码沙箱工厂
 */
public class CodeSandBoxFactory {

    /**
     * 创建代码沙箱实例
     * @param type
     * @return
     */
    public static CodeSandBox newInstance(String type) {
        switch (type) {
            case "example":
                return new ExampleCodeSandBoxImpl();
            case "remote":
                return new RemoteCodeSandBoxImpl();
            default:
                throw new RuntimeException("代码沙箱类型错误");
        }
    }



}
